package com.juc.cyclicbarrier.cyclicbarrier7;

public class Run {

	public static void main(String[] args) throws InterruptedException {
		
		MyService myService = new MyService();
		MyThreadA a = new MyThreadA(myService);
		a.setName("A");
		a.start();
		
		MyThreadB b = new MyThreadB(myService);
		b.setName("B");
		b.start();
		
		MyThreadC c = new MyThreadC(myService);
		c.setName("C");
		c.start();
		
		Thread.sleep(2000);
		System.out.println( " 屏障对象的 parties 个数为 " + myService.cyclicBarrier.getParties());
		System.out.println(" 在屏障处等待的线程个数为 " + myService.cyclicBarrier.getNumberWaiting());
	}
}
